package cn.com.apple.config;

import cn.com.apple.handle.GenericListTypeHandler;
import cn.com.apple.pojo.ProductBuyPair;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyBatisConfig {

    @Bean
    public ObjectMapper objectMapper() {
        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new JavaTimeModule()); // 关键代码
        return mapper;
    }

    @Bean
    public GenericListTypeHandler<?> productBuyPairListTypeHandler(ObjectMapper objectMapper) {
        return new GenericListTypeHandler<>(objectMapper, ProductBuyPair.class);
    }



}
